<?php
namespace app\home\controller;
use app\home\model\Channel;
use think\Request;
use think\Db;
class Index extends Base
{
    public function index()
    {
        $mark="index";
        $about=db("channel_page")->find(1);
        $about['content']=html_entity_decode($about['content']);
        $about['cname']=db("channel")->where("id=".$about['cid'])->value("name");
        $this->assign("about",$about);
		return view($mark);
    }
    public function getPrut()
    {
        $cid=request()->param('cid'); 
        $limit="4";
        $prowhere['cid']=$cid;
        $prowhere['status']=1;
        $prowhere['is_home']=1;
        $product=db("cms_product")->where($prowhere)->order("sort asc , id desc")->limit($limit)->select();
        for ($i=0; $i < count($product); $i++) { 
            $product[$i]['cname']=db("channel")->where("id=".$product[$i]['cid'])->value("name");
            // $product[$i]['annexes']=db("filex")->where("id=".$product[$i]['thumb'])->value("thumb");
        }
        // print_r($product);exit;
        $this->assign("product",$product);
        return view('getPrut');
    }
}
